<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <title style="text-align: center;">乐跑</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/mui.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="../css/base.css" />
    <link rel="stylesheet" href="../css/iconfont.css" />
    <link rel="stylesheet" href="../css/footer.css" />
    <link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />
    <script src="../js/mui.min.js"></script>
    <script src="../js/jquery-1.7.2.js"></script>
    <script src="../js/common.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

</head>
<style type="text/css">
    #pause img {
        opacity: 0.3;
    }

    #pause.active img {
        opacity: 1;
    }

    #inBill .mui-switch {
        /*z-index: 201;*/
    }

    .detail .house-address {
        top: 120px!important;
    }

    h5.mui-content-padded {
        margin-left: 3px;
        margin-top: 20px !important;
    }

    h5.mui-content-padded:first-child {
        margin-top: 12px !important;
    }

    .mui-btn {
        font-size: 16px;
        padding: 8px;
        margin: 3px;
    }

    .ui-alert {
        text-align: center;
        padding: 20px 10px;
        font-size: 16px;
    }

    * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
    }

    .date-picker {
        position: absolute;
        top: 0;
        height: 100%;
        right: 20px;
        /*background: red;*/
        padding: 0;
        margin: 0;
        width: 50%;
    }

    .house-basic-list {
        font-size: 0.85rem
    }

    .mui-table-viewBox {
        position: relative;
        margin-top: 0;
        margin-bottom: 0;
        padding-left: 0;
    }

    .mui-table-viewBox li {
        border-bottom: 1px solid #ddd;
    }

    .mui-bar-tab .mui-tab-item.mui-active {
        color: #5c9bc9;
    }

    .logo-container {
        width: 65px;
        height: 65px;
        position: relative;
        margin-top: 50px;
        border-radius: 50%;
        background: #86b3d4;
        margin: 60px auto 15px;
        display: inline-block;


    }

    .logo-container>#logo {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        border: none;
        padding: 0;
        margin: auto;
        border-image-width: 0;
    }
</style>

<body>

<header class="mui-header">
    <a class="mui-action-back mui-icon mui-icon-arrowleft"></a>
    <h1 class="mui-title">个人中心</h1>
</header>
<div class="mui-content mui-scroll-wrapper" style="overflow-y:scroll;bottom:50px;">
    <div class="logo-container">
        <!--<img src="" id="logo" />-->
    </div>


    <div style="float:left; position: absolute;background: #86b3d4;margin: 60px auto 15px;display: inline-block">
        <span id="nickname">吴自德</span>
        <span id="openid">123</span>
    </div>
    <div class="house-basic-list" style="margin-top: 0px;">
        <ul class="mui-table-viewBox">
            <!--<li class="mui-table-view-cell house date-choo">
                <a class="mui-navigate-right" id="houseAddress" href="../myYWGL/pushedHouse.html">
                    推送给我的房源
                </a>
                <div class="date-choosed"></div>
            </li>-->
            <li class="mui-table-view-cell house ">
                <a class="mui-navigate-right" id="setInfo" href="../myYWGL/selfInfo.html">
                    个人信息设置
                </a>
            </li>
        </ul>
    </div>
</div>
<!--b:底部-->
<footer class="mui-bar mui-bar-tab footer">
    <a class="mui-tab-item" href="../indexSearch/indexSearch.html">
        <span class="mui-icon home"></span>
        <span class="mui-tab-label">首页</span>
    </a>
    <a class="mui-tab-item" href="../indexSearch/searchPlace-1.html?search=1">
        <span class="mui-icon zhaofang"></span>
        <span class="mui-tab-label">活动</span>
    </a>
    <a class="mui-tab-item" href="javascript:void(0)">
        <span class="mui-icon"></span>
        <span class="mui-tab-label">我的</span>
        <span class="publish"></span>
    </a>
</footer>
<div class="publishbgfooter"></div>
<!--e:底部-->
<!--b:footer 发布代码-->
<a class="footerbgiconqiuzu" href="../rent/publishDemand.html">
    <!--<img src="../../images/publishqiuzu.png" />
    <span>求租</span>-->
    <img src="../../images/rentIcon.png" alt="" />
</a>
<a class="footerbgiconfangyuan" href="../publishHouse/publishHouse.html">
    <!--<img src="../../images/publishfangyuan.png" />
    <span>房源</span>-->
    <img src="../../images/houseIcon.png" alt="" />
</a>
<div class="publishbgheader"></div>
<script>
    $(function() {
        $("span.publish").parent().on("tap", function() {
            if($(".publish").attr("class").indexOf("cur") != -1) { //选中则关闭
                $(".footerbgiconqiuzu,.footerbgiconfangyuan,.publishbgheader,.publishbgfooter").hide()
                $(".publish").removeClass("cur")
            } else {
                $(".footerbgiconqiuzu,.footerbgiconfangyuan,.publishbgheader,.publishbgfooter").show()
                $(".publish").addClass("cur")
            }
        })

        /*//微信接口获取用户信息
        if(location.href.toLowerCase().lastIndexOf("?code=") == -1)
            userId = localStorage["userId"]
        else {
            var paramStr = location.href.split("?");
            var params = paramStr.length > 1 ? paramStr[1].split("&") : [];
            var code = params.length > 1 ? params[0].substring(5) : "";
            if(code)
                mui.getJSONP(serverAddress + "weixin/weixinInfo/getOpenId.do?command=getOpenId", {

                        data: JSON.stringify({
                            code: code
                        })
                    },
                    function(data) {
                        if(!data || data.ret != "200") return;
                        userId = data.result.openId;
                        weHead = data.result.weHead;
                        localStorage["userId"] = userId;
                        localStorage["weHead"] = weHead;
                    }
                );
        }*/
        //checkSDK();
        var code = getUrlParam("code");
        getUserInfo(code);
    })
    //获取url中的参数
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }

    //获取url中的参数
    function getUserInfo(code) {
        $.ajax({
            url:"/wx/wechat/getInfoByCode" , // 请求路径
            //data: "username=jack&age=23",//请求参数
            dataType:"json",//设置接受到的响应数据的格式
            data:{"code":code},
            type:"POST" , //请求方式
            success:function (data) {
                $('<img id="logo">').attr('src', data.data.headimgurl).appendTo('.logo-container');
                $("#nickname").text(data.data.nickname);
                $("#openid").text(data.data.openid);
            },//响应成功后的回调函数
            error:function () {
                alert("出错啦...")
            }//表示如果请求响应出现错误，会执行的回调函数
        });
    }
    function checkSDK(){
        mui.ajax(serverAddress+"weixin/weixinPlatform/weiXinShare.do?command=shareConfig",{
            data:JSON.stringify({url:document.URL}),
            contentType: "application/json",
            dataType:'json',//服务器返回json格式数据
            type:'post',//HTTP请求类型
            timeout:10000,//超时时间设置为10秒；
            headers:{'Content-Type':'application/json'},
            headers:{'Access-Control-Allow-Headers':'X-Requested-With'},
            success:function(data){
                //服务器返回响应，根据响应结果，分析是否登录成功；
                wx.config({
                    debug: false,
                    appId: data.result.appid,
                    timestamp: data.result.timestamp,
                    nonceStr: data.result.nonceStr,
                    signature: data.result.signature,
                    jsApiList: ['onMenuShareAppMessage','onMenuShareTimeline'] // 功能列表，我们要使用JS-SDK的什么功能
                });


                // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在 页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready 函数中。
                wx.ready(function(){
                    var imgshareUrl = $("#logo").attr("src")==undefined?logoUrl:$("#logo").attr("src").replace(/\\\\/g,"/").replace(/\\/g,"/");
                    // 获取"分享给朋友"按钮点击状态及自定义分享内容接口
                    wx.onMenuShareAppMessage({
                        title: '我的公里', // 分享标题
                        desc: '我的一万公里，记录自己的足迹', // 分享描述
                        link: autoUrl.replace("autourl",document.URL),
                        imgUrl:imgshareUrl, // 分享图标
                        type: 'link' // 分享类型,music、video或link，不填默认为link
                    });
                    // 获取"分享到朋友圈"按钮点击状态及自定义分享内容接口
                    wx.onMenuShareTimeline({
                        title: '我的一万公里，记录自己的足迹', // 分享标题
                        link: autoUrl.replace("autourl",document.URL),
                        imgUrl: imgshareUrl // 分享图标
                    });


                });

            },
            error:function(xhr,type,errorThrown){

            }
        })
    }
</script>
<!--e:footer 发布代码-->
</body>

<script src="../js/jquery.js"></script>
<script src="../js/mui.jsonp.js"></script>
<script src="../js/mui.picker.min.js"></script>

<script type="text/javascript">
    mui.ready(function() {
        /*mui.getJSONP(serverAddress + 'weixin/person/personCenter.do?command=myInformation', {
            data: JSON.stringify({
                userId: userId
            })
        }, function(data) {
            console.log(data)
            if(data && data.ret == '200') {
                if(data.result) {
                    id = data.result['id'];
                    if(data.result['fileSource']) {
                        $('<img id="logo">').attr('src', imgUrl + data.result['fileSource']).appendTo('.logo-container');
                    }else{
                        $('<img id="logo">').attr('src', localStorage["weHead"]).appendTo('.logo-container');
                    }
                }
            }
        })*/
    })

    mui(".house-basic-list").on('tap', ".mui-navigate-right", function(e) {
        //打开关于页面
        mui.openWindow({
            url: this.getAttribute("href"),
            id: 'info'
        });
        //location.href = this.getAttribute("href");
    });
    mui(".footer").on('tap', ".mui-tab-item", function(e) {
        //打开关于页面
        /*mui.openWindow({
        url: this.getAttribute("herf"),
        id:'info'
        });*/
        location.href = this.getAttribute("href");
    });
    mui.init({
        gestureConfig: {
            //    		swipe: false, //默认为true
            //    		tap: false, //默认为true
            //			doubletap: false, //默认为false
            //			longtap: false, //默认为false
            //			drag: false, //默认为true
            //			hold:false,//默认为false，不监听
            //			release:false//默认为false，不监听
            //			drag: false, //默认为true
            swipeup: false,
            swipedown: false,
        }
    });
</script>

</html>
